Intro

Basic analysis of Vancouver weather patterns:

Data Collection

Data is collected from Govt of Canada website:

  1. search: http://climate.weather.gc.ca/historical_data/search_historic_data_e.html
  2. specify station as containing ‘vancouver harbour’
  3. select ‘daily’, select ‘year’
  4. ‘Go’ goes to a page to access results for year

(process is automated in ‘van-weather-import.R’)

## [1] "Winter" "Spring" "Summer" "Fall"

Earliest date: 1988-01-01
Most recent date: 2019-07-26

Check data structure:

## Classes 'spec_tbl_df', 'tbl_df', 'tbl' and 'data.frame': 11527 obs. of  10 variables:
##  $ Month       : Factor w/ 12 levels "1","2","3","4",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ Season      : Factor w/ 4 levels "Winter","Spring",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ Date        : Date, format: "1988-01-01" "1988-01-02" ...
##  $ Year        : Factor w/ 32 levels "1988","1989",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ Day         : num  1 2 3 4 5 6 7 8 9 10 ...
##  $ Max.Temp    : num  3.2 2.5 5.2 3.3 4.3 4.5 5.7 5 6.8 7 ...
##  $ Min.Temp    : num  -0.9 -2 -1.5 0 1.7 1.7 2.7 1.2 2.1 4.7 ...
##  $ Mean.Temp   : num  1.2 0.3 1.9 1.7 3 3.1 4.2 3.1 4.5 5.9 ...
##  $ Total.Precip: num  0 0 0 0 0 0 0 5.6 2.4 0 ...
##  $ Season.Yr   : num  1988 1988 1988 1988 1988 ...
##  - attr(*, "spec")=
##   .. cols(
##   ..   Month = col_double(),
##   ..   Season = col_character(),
##   ..   Date = col_date(format = ""),
##   ..   Year = col_double(),
##   ..   Day = col_double(),
##   ..   Max.Temp = col_double(),
##   ..   Min.Temp = col_double(),
##   ..   Mean.Temp = col_double(),
##   ..   Total.Precip = col_double(),
##   ..   Season.Yr = col_double()
##   .. )

Earliest date: 1988-01-01
Most recent date: 2019-07-26

Check Data Relationships

  • uses PerformanceAnalytics package

Precipitation

Monthly precipitation data: Averages

Data by Month - ranked in order of highest precipitation

Monthly Preciptiation: Ranges

Current Month Precipitation

Monthly Comparison YoY

For each month, what has been the pattern in precipitation over the years?

Seasonal Precipitation

Season definitions:

  • Winter: Dec, Jan, Feb
  • Spring: Mar, Apr, May
  • Summer: Jun, Jul, Aug
  • Fall: Sep, Oct, Nov

Note: the year for a winter season is applied to year at end of season. So winter from Dec 2018 to Feb 2019 is considered winter of 2019.

Seasonal Precipitation Annual Ranking

  • Need separate charts because each season ranked individually
  • Line = median

Temperature

Ave. Annual Temperature

  • Obvious outliers 1988, 1989, 2011: shown down below, temperature data is missing for multiple months, bringing ave. temp way down. Best to discard.
  • Could use more sophisticated imputation of missing values, such as using averages, to preserve data for other months in those years

Years Ranked by Average Daily Temp

Linear model of annual temperature change

## 
## Call:
## lm(formula = mean.mean ~ ynum, data = vw.temp.yr)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.05622 -0.45445 -0.02806  0.49582  1.08036 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)
## (Intercept) 18.051768  27.580534   0.655    0.519
## ynum        -0.003263   0.013763  -0.237    0.815
## 
## Residual standard error: 0.5741 on 23 degrees of freedom
## Multiple R-squared:  0.002437,   Adjusted R-squared:  -0.04093 
## F-statistic: 0.0562 on 1 and 23 DF,  p-value: 0.8147

Model interpretation:

  • Average daily temperature changing -0.0032627 degrees each yr.
  • P-value for statistical significance: 0.8147074
  • Temperature change is not statistically significant over this period

Look at Average Daily Maximum and Minimums for each Year

Linear modelling for max and min

## 
## Call:
## lm(formula = mean.max ~ ynum, data = vw.temp.yr)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.20519 -0.37770 -0.07791  0.44992  1.25842 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)
## (Intercept) 21.17014   30.31711   0.698    0.492
## ynum        -0.00328    0.01513  -0.217    0.830
## 
## Residual standard error: 0.631 on 23 degrees of freedom
## Multiple R-squared:  0.00204,    Adjusted R-squared:  -0.04135 
## F-statistic: 0.04702 on 1 and 23 DF,  p-value: 0.8303

Model interpretation:

  • Average daily MAX temperature changing -0.0032804 degrees each yr.
  • P-value for statistical significance: 0.8302501
  • Temperature change is not statistically significant over this period
## 
## Call:
## lm(formula = mean.min ~ ynum, data = vw.temp.yr)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.89768 -0.44617  0.00104  0.51939  0.86951 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)
## (Intercept) 13.911637  27.023795   0.515    0.612
## ynum        -0.002766   0.013485  -0.205    0.839
## 
## Residual standard error: 0.5625 on 23 degrees of freedom
## Multiple R-squared:  0.001825,   Adjusted R-squared:  -0.04157 
## F-statistic: 0.04206 on 1 and 23 DF,  p-value: 0.8393

Model interpretation:

  • Average daily MIN temperature changing -0.0027657 degrees each yr.
  • P-value for statistical significance: 0.8393054
  • Temperature change is not statistically significant over this period

Monthly average temperature

Monthly Temperatures: Ranges

Monthly Temp. Comparison YoY

For each month, what has been the pattern in ave. temperature over the years?

Seasonal Temperatures

Season definitions:

  • Winter: Dec, Jan, Feb
  • Spring: Mar, Apr, May
  • Summer: Jun, Jul, Aug
  • Fall: Sep, Oct, Nov

Note: the year for a winter season is applied to year at end of season. So winter from Dec 2018 to Feb 2019 is considered winter of 2019.